package com.mathdroid.model.enums;

import java.util.LinkedList;

/**
 * An item stat has a name, can be a primary stat and can be offensive or
 * defensive.
 */
public enum EItemStat {
	/**
	 * Min Damage on weapons.
	 */
	MIN_DAMAGE("Min Damage", false, true, "mindamage"),
	/**
	 * Max Damage on weapons.
	 */
	MAX_DAMAGE("Max Damage", false, true, "maxdamage"),
	/**
	 * Aim.
	 */
	AIM("Aim", true, true, "aim"),
	/**
	 * Cunning.
	 */
	CUNNING("Cunning", true, true, "cunning"),
	/**
	 * Strength.
	 */
	STRENGTH("Strength", true, true, "strength"),
	/**
	 * Willpower.
	 */
	WILLPOWER("Willpower", true, true, "willpower"),
	/**
	 * Endurance.
	 */
	ENDURANCE("Endurance", true, false, "endurance"),
	/**
	 * Presence.
	 */
	PRESENCE("Presence", false, true, "presence"),
	/**
	 * Power.
	 */
	POWER("Power", false, true, "power"),
	/**
	 * Force Power.
	 */
	FORCEPOWER("Force Power", false, true, "forcepower"),
	/**
	 * Tech Power.
	 */
	TECHPOWER("Tech Power", false, true, "techpower"),
	/**
	 * Accuracy.
	 */
	ACCURACY_RATING("Accuracy Rating", false, true, "accuracyrating"),
	/**
	 * Crit.
	 */
	CRITICAL_RATING("Critical Rating", false, true, "criticalrating"),
	/**
	 * Surge.
	 */
	SURGE_RATING("Surge Rating", false, true, "surgerating"),
	/**
	 * Armor.
	 */
	ARMOR("Armor", false, false, "armor"),
	/**
	 * Defense.
	 */
	DEFENSE_RATING("Defense Rating", false, false, "defenserating"),
	/**
	 * Shield.
	 */
	SHIELD("Shield", false, false, "shield"),
	/**
	 * Absorption.
	 */
	ABSORPTION_RATING("Absorption Rating", false, false, "absorptionrating"),
	/**
	 * Alacrity.
	 */
	ALACRITY_RATING("Alacrity Rating", false, true, "alacrityrating"),
	/**
	 * Expertise.
	 */
	EXPERTISE_RATING("Expertise Rating", false, true, "expertiserating");
	
	/**
	 * The name of the stat.
	 */
	private String name = null;
	
	/**
	 * The name of the XML tag.
	 */
	private String xmlTag = null;
	
	/**
	 * If the stat is a primary stat.
	 */
	private boolean primary = false;
	
	/**
	 * If the stat is an offensive stat.
	 */
	private boolean offensive = false;
	
	/**
	 * Create a new stat.
	 * @param n Name.
	 * @param isPrimary If it is a primary stat.
	 * @param isOffensive If it is an offensive stat.
	 * @param x The name of the XML tag.
	 */
	EItemStat(final String n, final boolean isPrimary, 
			final boolean isOffensive, final String x) {
		this.name = n;
		this.primary = isPrimary;
		this.offensive = isOffensive;
		this.xmlTag = x;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * @return The XML tag.
	 */
	public String getXMLtag() {
		return this.xmlTag;
	}

	/**
	 * @return the primary
	 */
	public boolean isPrimary() {
		return primary;
	}

	/**
	 * @return the offensive
	 */
	public boolean isOffensive() {
		return offensive;
	}
	
	/**
	 * Get a list of all item stats. The list is sorted alphabetically.
	 * @return List of all item stats.
	 */
	public static final LinkedList<EItemStat> getAllStats() {
		final LinkedList<EItemStat> l = new LinkedList<EItemStat>();
		
		l.add(EItemStat.ABSORPTION_RATING);
		l.add(EItemStat.ACCURACY_RATING);
		l.add(EItemStat.AIM);
		l.add(EItemStat.ALACRITY_RATING);
		l.add(EItemStat.ARMOR);
		l.add(EItemStat.CRITICAL_RATING);
		l.add(EItemStat.CUNNING);
		l.add(EItemStat.DEFENSE_RATING);
		l.add(EItemStat.ENDURANCE);
		l.add(EItemStat.EXPERTISE_RATING);
		l.add(EItemStat.FORCEPOWER);
		l.add(EItemStat.MAX_DAMAGE);
		l.add(EItemStat.MIN_DAMAGE);
		l.add(EItemStat.POWER);
		l.add(EItemStat.PRESENCE);
		l.add(EItemStat.SHIELD);
		l.add(EItemStat.STRENGTH);
		l.add(EItemStat.SURGE_RATING);
		l.add(EItemStat.TECHPOWER);
		l.add(EItemStat.WILLPOWER);
		
		return l;
	}
}
